package com.jh.complicate.serializable;

import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

/**
 * @author Administrator
 * @projectName newforward
 * @title ServerSocketConsumer.java
 * @package com.jh.complicate.serializable
 * @description ServerSocket客户端
 * @date 2019/6/4 18:21
 */
public class ServerSocketConsumer {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("localhost", 8080);

        User user = new User();
        user.setAge(1);
        user.setName("JH");

        ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
        oos.writeObject(user);

        oos.close();
        socket.close();
    }
}
